home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / TranslationExtensions.a < prev    next >
Encoding:
Text File  |  1996-01-24  |  5.4 KB  |  168 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        TranslationExtensions.a
  3. ;
  4. ;    Contains:    Macintosh Easy Open Translation Extension Interfaces.
  5. ;
  6. ;    Version:    Technology:    Macintosh Easy Open 1.1
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__TRANSLATIONEXTENSIONS__') = 'UNDEFINED' THEN
  21. __TRANSLATIONEXTENSIONS__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__MEMORY__') = 'UNDEFINED' THEN
  25.     include 'Memory.a'
  26.     ENDIF
  27. ;        include 'Types.a'                                            ;
  28. ;            include 'ConditionalMacros.a'                            ;
  29. ;        include 'MixedMode.a'                                        ;
  30.  
  31.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  32.     include 'Files.a'
  33.     ENDIF
  34. ;        include 'OSUtils.a'                                        ;
  35. ;        include 'Finder.a'                                            ;
  36.  
  37.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  38.     include 'Quickdraw.a'
  39.     ENDIF
  40. ;        include 'QuickdrawText.a'                                    ;
  41.  
  42.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  43.     include 'Components.a'
  44.     ENDIF
  45.  
  46. kSupportsFileTranslation        EQU        1
  47. kSupportsScrapTranslation        EQU        2
  48. kTranslatorCanGenerateFilename    EQU        4
  49.  
  50. ; typedef OSType             FileType
  51. ; typedef ResType             ScrapType
  52. ; typedef unsigned long     TranslationAttributes
  53.  
  54. taDstDocNeedsResourceFork        EQU        1
  55. taDstIsAppTranslation            EQU        2
  56.  
  57. FileTypeSpec             RECORD    0
  58. format                     ds.l   1        ; offset: $0 (0)
  59. hint                     ds.l   1        ; offset: $4 (4)
  60. flags                     ds.l   1        ; offset: $8 (8)        ; taDstDocNeedsResourceFork, taDstIsAppTranslation
  61. catInfoType                 ds.l   1        ; offset: $C (12)
  62. catInfoCreator             ds.l   1        ; offset: $10 (16)
  63. sizeof                     EQU *            ; size:   $14 (20)
  64.                         ENDR
  65.  
  66. ; typedef struct FileTypeSpec  FileTypeSpec
  67. FileTranslationList     RECORD    0
  68. modDate                     ds.l   1        ; offset: $0 (0)
  69. groupCount                 ds.l   1        ; offset: $4 (4)
  70. ;     unsigned long    group1SrcCount;
  71. ;     unsigned long    group1SrcEntrySize = sizeof(FileTypeSpec);
  72. ;  FileTypeSpec    group1SrcTypes[group1SrcCount]
  73. ;  unsigned long    group1DstCount;
  74. ;  unsigned long    group1DstEntrySize = sizeof(FileTypeSpec);
  75. ;  FileTypeSpec    group1DstTypes[group1DstCount]
  76. sizeof                     EQU *            ; size:   $8 (8)
  77.                         ENDR
  78.  
  79. ; typedef struct FileTranslationList  FileTranslationList
  80. ; typedef FileTranslationList  *FileTranslationListPtr, **FileTranslationListHandle
  81. ScrapTypeSpec             RECORD    0
  82. format                     ds.l   1        ; offset: $0 (0)
  83. hint                     ds.l   1        ; offset: $4 (4)
  84. sizeof                     EQU *            ; size:   $8 (8)
  85.                         ENDR
  86.  
  87. ; typedef struct ScrapTypeSpec  ScrapTypeSpec
  88. ScrapTranslationList     RECORD    0
  89. modDate                     ds.l   1        ; offset: $0 (0)
  90. groupCount                 ds.l   1        ; offset: $4 (4)
  91. ;     unsigned long        group1SrcCount;
  92. ;     unsigned long        group1SrcEntrySize = sizeof(ScrapTypeSpec);
  93. ;  ScrapTypeSpec        group1SrcTypes[group1SrcCount]
  94. ;  unsigned long        group1DstCount;
  95. ;     unsigned long        group1DstEntrySize = sizeof(ScrapTypeSpec);
  96. ;  ScrapTypeSpec        group1DstTypes[group1DstCount]
  97. sizeof                     EQU *            ; size:   $8 (8)
  98.                         ENDR
  99.  
  100. ; typedef struct ScrapTranslationList  ScrapTranslationList
  101. ; typedef ScrapTranslationList  *ScrapTranslationListPtr, **ScrapTranslationListHandle
  102. ; definition of callbacks to update progress dialog
  103. ; typedef long                 TranslationRefNum
  104. ;****************************************************************************************
  105. ;*
  106. ;* This routine sets the advertisement in the top half of the progress dialog.
  107. ;* It is called once at the beginning of your DoTranslateFile routine.
  108. ;*
  109. ;* Enter:    refNum            Translation reference supplied to DoTranslateFile.
  110. ;*            advertisement    A handle to the picture to display.  This must be non-purgable.
  111. ;*                            Before returning from DoTranslateFile, you should dispose
  112. ;*                            of the memory.  (Normally, it is in the temp translation heap
  113. ;*                            so it is cleaned up for you.)
  114. ;*
  115. ;* Exit:    returns            noErr, paramErr, or memFullErr
  116. ;
  117. ;
  118. ; pascal OSErr SetTranslationAdvertisement(TranslationRefNum refNum, PicHandle advertisement)
  119. ;
  120.     IF ¬ GENERATINGCFM THEN
  121.         Macro
  122.         _SetTranslationAdvertisement
  123.             moveq    #2,d0
  124.             dc.w     $ABFC
  125.         EndM
  126.     ELSE
  127.         IMPORT_CFM_FUNCTION    SetTranslationAdvertisement
  128.     ENDIF
  129.  
  130. ;****************************************************************************************
  131. ;*
  132. ;* This routine updates the progress bar in the progress dialog.
  133. ;* It is called repeatedly from within your DoTranslateFile routine.
  134. ;* It should be called often, so that the user will get feedback if he tries to cancel.
  135. ;*
  136. ;* Enter:    refNum        translation reference supplied to DoTranslateFile.
  137. ;*            progress    percent complete (0-100)
  138. ;*
  139. ;* Exit:        canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  140. ;*            returns        noErr, paramErr, or memFullErr
  141. ;
  142. ;
  143. ; pascal OSErr UpdateTranslationProgress(TranslationRefNum refNum, short percentDone, Boolean *canceled)
  144. ;
  145.     IF ¬ GENERATINGCFM THEN
  146.         Macro
  147.         _UpdateTranslationProgress
  148.             moveq    #1,d0
  149.             dc.w     $ABFC
  150.         EndM
  151.     ELSE
  152.         IMPORT_CFM_FUNCTION    UpdateTranslationProgress
  153.     ENDIF
  154.  
  155. ; ComponentMgr selectors for routines
  156.  
  157. kTranslateGetFileTranslationList EQU        0                    ; component selectors
  158. kTranslateIdentifyFile            EQU        1
  159. kTranslateTranslateFile            EQU        2
  160. kTranslateGetTranslatedFilename    EQU        3
  161. kTranslateGetScrapTranslationList EQU        10                ; skip to scrap routines
  162. kTranslateIdentifyScrap            EQU        11
  163. kTranslateTranslateScrap        EQU        12
  164.  
  165. ; Routines to implment in a file translation extension
  166. ; Routine to implement in a scrap translation extension
  167.     ENDIF ; __TRANSLATIONEXTENSIONS__
  168.